import { createBrowserRouter, Navigate } from "react-router-dom";
import Login from "@/pages/Login";
import Home from "@/pages/Home";
import Loyout from "@/pages/Layout";
import NotFound from "@/pages/NotFound";
import systemManageRouter from "./moudles/SystemManage";
import schoolManage from "./moudles/SchoolManage";

// * 创建路由表
export const router = [
  {
    path: "/",
    element: <Navigate to="/home" />, // 重定向
  },
  {
    path: "/login",
    element: <Login />,
  },
  {
    element: <Loyout />,
    children: [{ path: "home", element: <Home />, meta: { name: "首页总览" } }, ...systemManageRouter, ...schoolManage],
  },
  {
    path: "*",
    element: <NotFound />,
  },
];

export default createBrowserRouter(router);
